<template>
	<view class="container">
		<TopBtn :title="'消息通知'"></TopBtn>
		<view class="info">
			<view class="row" @click.stop="goInfo2(n.jumpUrl)" v-for="n in list" :key="n.id">
				<view class="">
					<view class="time">
						<uni-dateformat :date="n.createTime" format="yyyy-MM-dd hh:mm"></uni-dateformat>
					</view>
					<view class="Box">
						<view class="title">
							{{n.title}}
						</view>
						<view class="text">
							{{n.content}}
						</view>
						<view class="xq flex-sp-center">
							查看详情 <uni-icons type="right" color="#999" size="16"></uni-icons>
						</view>
						<view class="dian" v-if="n.readStatus==0">

						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		notifyMessagePage
	} from '@/api/user'
	export default {
		data() {
			return {
				list: [],
				request: {
					pageNo: 1,
					pageSize: 10,
				},
				maxNum: "",
			};
		},
		onShow() {
			this.list = []
			this.request.pageNo = 1
			this.notifyMessagePage()
		},
		onReachBottom() {
			if (this.maxNum <= this.request.pageNo) return
			this.request.pageNo = this.request.pageNo + 1
			this.notifyMessagePage()
		},
		methods: {
			notifyMessagePage() {
				notifyMessagePage(this.request).then(res => {
					this.list.push(...res.data.list)
					let num = res.data.total / this.request.pageSize
					if (num.toString().includes('.')) {
						num = Math.ceil(num)
					}
					this.maxNum = num
				})
			},
			goInfo2(e) {
				uni.navigateTo({
					url: e,
				})
			},
			goInfo(e) {
				uni.navigateTo({
					url: `/pages/my/newsDetails/newsDetails?id=${e}`,
				})
			},
		}
	}
</script>

<style lang="less" scoped>
	.container {



		.info {
			padding: 0 30rpx 30rpx;

			.row {
				margin-top: 30rpx;

				.time {
					font-weight: 500;
					font-size: 22rpx;
					color: #999999;
					text-align: center;
					margin-bottom: 29rpx;
				}

				.Box {
					width: 690rpx;
					min-height: 223rpx;
					background: #FFFFFF;
					border-radius: 15rpx;
					padding: 20rpx;
					box-sizing: border-box;
					position: relative;

					.title {
						font-weight: bold;
						font-size: 30rpx;
						color: #333333;
					}

					.text {
						font-weight: 500;
						font-size: 28rpx;
						color: #999999;
						padding: 20rpx 0;
						border-bottom: 1px solid #EEEEEE;
					}

					.xq {
						margin-top: 26rpx;
						font-weight: 500;
						font-size: 26rpx;
						color: #3E6EFE;
					}

					.dian {
						width: 18rpx;
						height: 18rpx;
						background: #FF4D3D;
						border-radius: 9rpx;
						position: absolute;
						top: 20rpx;
						right: 20rpx;
					}
				}
			}
		}
	}
</style>